Method and system for estimating offset in environments with limited memory space

ABSTRACT

A computer implemented method, system and computer program product for estimating an offset of at least one sensor is disclosed. The computer implemented method, system and computer program product comprise calculating combinations of running sums to define for computing /or one or more slopes for the sensor. At least one of the one or more slopes provides an indication of the sensor offset changes with temperature.

FIELD OF THE INVENTION

The present invention relates generally to sensor systems and morespecifically to estimating an offset on sensor systems of a device as afunction of temperature.

BACKGROUND

Sensor systems are utilized in a plurality of environments to determinethe orientation of a device. The sensor systems can oftentimes includeany combination of gyroscopes, accelerometers and magnetometers toprovide the orientation information. It is known that an offset of asensor can be estimated as a function of temperature. Howevertraditionally the computation of offset estimation can require asignificant amount of memory. Accordingly what is desired is a systemand method that provides the offset estimation computation but usessignificantly lees memory bandwidth than conventional solutions. Themethod and system should be simple, easily implemented and adaptable toexisting environments. The present invention addresses such a need.

SUMMARY OF THE INVENTION

A computer implemented method, system and computer program product forestimating an offset of at least one sensor is disclosed. The computerimplemented method, system and computer program product comprisecalculating combinations of running sums to define for computing /or oneor more slopes for the sensor. At least one of the one or more slopesprovides an indication of the sensor offset changes with temperature.

Other aspects and advantages of the present invention will becomeapparent from the following detailed description, taken in conjunctionwith the accompanying drawings, illustrating by way of example theprinciples of the invention.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a system that utilizes an offset estimationalgorithm in accordance with an embodiment.

FIG. 2 is a flow chart that illustrates utilizing the offset with thetemperature in accordance with the present invention.

FIG. 3 is a flow chart that illustrates the offset estimation process inaccordance with the present invention.

FIG. 4A illustrates the variables to be utilized for offset estimationfor a three element gyroscope.

FIG. 4B shows a plot of the data, and the resulting curve fit.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

The present invention relates generally to sensor systems and morespecifically to estimating an offset on the sensor systems of a deviceas a function of temperature in such sensor systems. The followingdescription is presented to enable one of ordinary skill in the art tomake and use the invention and is provided in the context of a patentapplication and its requirements. Various modifications to the preferredembodiment and the generic principles and features described herein willbe readily apparent to those skilled in the art. Thus, the presentinvention is not intended to be limited to the embodiment shown but isto be accorded the widest scope consistent with the principles andfeatures described herein.

A system and method in accordance with the present invention providesfor temperature compensation via the estimation of an offset for motionsensors such as gyroscopes, accelerometers and magnetometers, when thesensors are used in environments where there is limited memory. Suchenvironments include, for example, mobile devices such as, cell phones,tablet PCs, portable electronics and the like that are designed formobility. Often the offset of sensors in such environments can beestimated as a function of temperature. The simplest function that canbe used for the offset estimate is a line that represents a plurality ofdata points of temperature. To compute the best fit line, a history ofthe offset and corresponding temperatures must be recorded. Typically,keeping track of all the offsets and their corresponding temperaturesutilizes a significant amount of the memory resources of the mobiledevice.

A system and method in accordance with the present invention providesfor the estimation of an offset due to temperature that utilizessignificantly less memory resources than known techniques. To describethe features of the offset estimation methodology refer now to thefollowing description in conjunction with the accompanying figures.

FIG. 1 is a block diagram of a system that utilizes an offset estimationalgorithm in accordance with an embodiment. FIG. 1 is a block diagram ofa system 10 that utilizes an offset estimation algorithm 100 inaccordance with an embodiment. The system 10 includes a device 11. Thedevice 11 may include any type of mobile device including but notlimited to, a cell phone, a tablet PC, or other type of portableelectronic device. The device 11 receives input data from a plurality ofsensors such as one or more magnetometers 12, one or more accelerometers14 and one or more gyroscopes 16. Although the sensors 12, 14 and 16 areshown external to the device 11, one of ordinary skill in the artreadily recognizes that those sensors could be internal to the device 11and that would be within the spirit and scope of the present invention.

The device 11 includes memory 18 for storing data. Data 20 stores datafrom the magnetometer 12, the accelerometer 14 and the gyroscope 16.Memory 18 also includes an offset estimation algorithm 100 in accordancewith the present invention. A processor 24 executes the algorithm 100which operates on the data received from the sensors 12-16. Theprocessor 24 provides the executed data to a sensor fusion 19. Thesensor fusion 19 provides orientation information of the device.

A system and method in accordance with the present invention provides atemperature compensation mechanism which utilizes offset estimation forsensors such as gyroscopes, accelerometers and magnetometers, in devicesthat have limited memory. Often the offset for sensors can be estimatedas a function of temperature. The simplest function that can be usedestimate the offset is a line. To compute the best fit line a history ofthe offset and corresponding temperatures must be recorded. Keepingtrack of all of the offsets and corresponding temperatures utilizes asignificant amount of memory. An offset estimation algorithm inaccordance with the present invention estimates the offset in a mannerthat utilizes significantly less memory.

A system that utilizes an offset estimation algorithm in accordance withthe present invention can take the form of an entirely hardwareimplementation, an entirely software implementation, or animplementation containing both hardware and software elements. In oneimplementation, the offset estimation algorithm is implemented insoftware, which includes, but is not limited to, application software,firmware, resident software, microcode, etc.

Furthermore, the offset estimation algorithm can take the form of acomputer program product accessible from a computer-usable orcomputer-readable medium providing program code for use by or inconnection with a computer or any instruction execution system. For thepurposes of this description, a computer-usable or computer-readablemedium can be any apparatus that can contain, store, communicate,propagate, or transport the program for use by or in connection with theinstruction execution system, apparatus, or device.

The medium can be an electronic, magnetic, optical, electromagnetic,infrared, or semiconductor system (or apparatus or device) or apropagation medium. Examples of a computer-readable medium include asemiconductor or solid state memory, magnetic tape, a removable computerdiskette, a random access memory (RAM), a read-only memory (ROM), arigid magnetic disk, and an optical disk. Current examples of opticaldisks include DVD, compact disk-read-only memory (CD-ROM), and compactdisk-read/write (CD-R/W). To describe the features of the presentinvention in more detail, refer now to the following description inconjunction with the accompanying Figures.

An equation of a line representing a graph or chart of temperatureversus offset can be expressed as:

y=mx+b,

where m is the slope and b is the offset (y-intercept).

To compute the slope between 2 points (x1,y1) and (x2,y2) is simply:

$\begin{matrix}{{slope} = \frac{{y\; 2} - {y\; 1}}{{x\; 2} - {x\; 1}}} & {{Equation}\mspace{11mu} 1}\end{matrix}$

To compute the average slope over a set of points, the followingequation can be used:

$\begin{matrix}{{slope} = {\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\; \left\lbrack \frac{\left( {y_{j} - y_{i}} \right)}{\left( {x_{j} - x_{i}} \right)} \right\rbrack}}} & {{Equation}\mspace{11mu} 2}\end{matrix}$

The temperature will be the x values in the equation and the offset willbe the y values. All of the temperature and offset values are affectedby noise. Instead of taking the average, a weighted average with weightfactors based upon how far apart the points are in x (or temperature) iscomputed. Weighting by the distance in the x dimension gives the sameanswer as a minimum squared error through a set of points. More emphasison the data points that are far apart is what is desired. Accordinglythe distance to the third power along the x dimension is used. Using thedistance leads to the equation:

$\begin{matrix}{{slope} = \frac{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\left\lbrack {\left( {y_{j} - y_{i}} \right) \cdot \left( {x_{j} - x_{i}} \right)^{3}} \right\rbrack}}{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\left( {x_{j} - x_{i}} \right)^{4}}}} & {{Equation}\mspace{11mu} 3}\end{matrix}$

The above equation is still difficult to compute, so next the identityis used:

$\begin{matrix}{{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\left\lbrack {\left( {b_{j} - b_{i}} \right) \cdot \left( {a_{j} - a_{i}} \right)} \right\rbrack}} = {\quad{\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left( {b_{i} \cdot a_{i}} \right)}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; \left( b_{i} \right)} \right\rbrack \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\; \left( a_{i} \right)} \right\rbrack}}}} & {{Equation}\mspace{14mu} 4}\end{matrix}$

Then the slope equation is rewritten such that the identity can beapplied that is described Equation 4.

$\begin{matrix}{{slope} = \frac{\begin{matrix}{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\left\lbrack {{\left\lbrack {\left( x_{j} \right)^{3} - \left( x_{i} \right)^{3}} \right\rbrack \cdot \left( {y_{j} - y_{i}} \right)} - {3 \cdot}} \right.}} \\{\left\lbrack {\left( {{x_{j}y_{j}} - {x_{i}y_{i}}} \right) \cdot \left\lbrack {\left( x_{j} \right)^{2} - \left( x_{i} \right)^{2}} \right\rbrack} \right\rbrack +} \\\left. {3 \cdot \left\lbrack {\left( {x_{i} - x_{j}} \right) \cdot \left\lbrack {\left( x_{i} \right)^{2} - \left( x_{i} \right)^{2}} \right\rbrack} \right\rbrack} \right\rbrack\end{matrix}}{\begin{matrix}{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\left\lbrack {{4 \cdot \left( {x_{j} - x_{i}} \right) \cdot \left\lbrack {\left( x_{j} \right)^{3} - \left( x_{i} \right)^{3}} \right\rbrack} -} \right.}} \\\left. {{3\left\lbrack {\left( x_{j} \right)^{2} - \left( x_{i} \right)^{2}} \right\rbrack} \cdot \left\lbrack {\left( x_{j} \right)^{2} - \left( x_{i} \right)^{2}} \right\rbrack} \right\rbrack\end{matrix}}} & {{Equation}\mspace{14mu} 5}\end{matrix}$

Applying the identity in Equation 4 to Equation 5 yields the followingEquation 6:

$\begin{matrix}{{slope} = \frac{\begin{matrix}{\left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left\lbrack {\left( x_{i} \right)^{3} \cdot y_{i}} \right\rbrack}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{3}} \right\rbrack \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\; \left( y_{i} \right)} \right\rbrack}} \right\rbrack -} \\{{3 \cdot \left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left\lbrack {\left( x_{i} \right)^{3} \cdot y_{i}} \right\rbrack}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; x_{i}^{2}} \right\rbrack \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\left( {x_{i} \cdot y_{i}} \right)} \right\rbrack}} \right\rbrack} +} \\{{3 \cdot \left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left\lbrack {\left( x_{i} \right)^{3} \cdot y_{i}} \right\rbrack}} \right\rbrack - {\left( {\sum\limits_{i = 1}^{N}\; x_{i}} \right) \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\mspace{11mu} \left\lbrack {\left( x_{i} \right)^{2} \cdot y_{i}} \right\rbrack} \right\rbrack}} \right\rbrack} -} \\\left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left\lceil {\left( x_{i} \right)^{4} \cdot y_{i}} \right\rceil}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{4}} \right\rbrack \cdot \left( {\sum\limits_{i = 1}^{N}\; y_{i}} \right)}} \right\rbrack\end{matrix}}{\begin{matrix}{{4\left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left\lbrack {\left( x_{i} \right)^{3}x_{i}} \right\rbrack}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{3}} \right\rbrack \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)} \right\rbrack}} \right\rbrack} -} \\{3 \cdot \left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{4}}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{3}} \right\rbrack \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{2}} \right\rbrack}} \right\rbrack}\end{matrix}}} & {{Equation}\mspace{14mu} 6}\end{matrix}$

Next, equation 6 is simplified to provide equation 7 below:

$\begin{matrix}{{slope} = \frac{\begin{matrix}{{{3 \cdot {\sum\limits_{i = 1}^{N - 1}{\left( {x_{i} \cdot y_{i}} \right) \cdot {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{2}}}}} - {3 \cdot {\sum\limits_{i = 1}^{N}\; {x_{i} \cdot}}}}\;} \\{{\sum\limits_{i = 1}^{N}\left\lbrack {\left( x_{i} \right)^{2} \cdot y_{i}} \right\rbrack} - {\sum\limits_{i = 1}^{N}\; {y_{i} \cdot {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{3}}}} + {N \cdot {\sum\limits_{i = 1}^{N}\left\lbrack \; {\left( x_{i} \right)^{3} \cdot y_{i}} \right\rbrack}}}\end{matrix}}{{{3 \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{2}} \right\rbrack^{2}} - {4 \cdot {\sum\limits_{i = 1}^{N}{x_{i} \cdot {\sum\limits_{i = 1}^{N}\left( x_{i} \right)^{3}}}}} + {N \cdot {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{4}}}}\;}} & {{Equation}\mspace{14mu} 7}\end{matrix}$

Equation 7 is written in a manner that provides for the calculation ofeight running sums (x_(i)y_(i), x_(i) ², x_(i), x_(i) ²y_(i), y_(i),x_(i) ³, x_(i) ³y_(i), x_(i) ⁴). As a result, it is not necessary tohave to keep track of the past values. The eight running sums and N areupdated with each new set of points that are utilized to fit to a curveor line. To avoid overflow and loss of sensitivity all of the runningsums can be divided by a factor and also the number of points, N, can bedivided by the same factor. The division can be based upon threshold forthe sums or number of points and/or based upon reaching a particularspread of values. In addition it may be beneficial to keep track of themaximum and minimum temperature range. The curve fit can only be used ifthe temperature is within a particular range.

The y-intercept for the line still needs to be computed. Given 2 points(x1,y1) and (x2,y2) the y-intercept would be:

$\begin{matrix}\frac{\left( {{y\; {1 \cdot x}\; 2} - {x\; {1 \cdot y}\; 2}} \right)}{\left( {{x\; 2} - {x\; 1}} \right)} & {{Equation}\mspace{14mu} 8}\end{matrix}$

To compute the average y-intercept for a range of points, the followingEquation 9 would be used:

$\begin{matrix}{{intercept} = \frac{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\; \left( {{y_{i} \cdot x_{j}} - {x_{i} \cdot y_{j}}} \right)}}{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\; \left( {x_{j} - x_{i}} \right)}}} & {{Equation}\mspace{14mu} 9}\end{matrix}$

As was done for the slope, the 3^(rd) power of the distance along thex-axis needs to be weighted. The following Equation 10 results:

$\begin{matrix}{{intercept} = \frac{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\left\lbrack {\left( {{y_{i} \cdot x_{j}} - {x_{i} \cdot y_{j}}} \right) \cdot \left( {x_{j} - x_{i}} \right)^{3}} \right\rbrack}}{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\left( {x_{j} - x_{i}} \right)^{4}}}} & {{Equation}\mspace{14mu} 10}\end{matrix}$

Which can be rewritten as Equation 1

$\begin{matrix}{{intercept} = \frac{\begin{matrix}{{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\left\lbrack {3 \cdot \left\lbrack {{x_{j} \cdot y_{j}} - {x_{i} \cdot y_{i}}} \right) \cdot \left\lbrack {\left( x_{j} \right)^{3} - \left( x_{i} \right)^{3}} \right\rbrack} \right\rbrack}} +} \\{{\left\lbrack {{\left( x_{j} \right)^{3} \cdot y_{j}} - {\left( x_{i} \right)^{3} \cdot y_{i}}} \right\rbrack \cdot \left( {x_{j} - x_{i}} \right)} - {3 \cdot}} \\{\left\lbrack {\left\lbrack {{\left( x_{j} \right)^{2} \cdot y_{j}} - {\left( x_{i} \right)^{2} \cdot y_{i}}} \right\rbrack \cdot \left\lbrack {\left( x_{j} \right)^{2} - \left( x_{i} \right)^{2}} \right\rbrack} \right\rbrack -} \\\left. {\left( {y_{i} - y_{j}} \right) \cdot \left\lbrack {\left( x_{i} \right)^{4} - \left( x_{j} \right)^{4}} \right\rbrack} \right\rbrack\end{matrix}}{\begin{matrix}{\sum\limits_{i = 1}^{N - 1}\; {\sum\limits_{j = {i + 1}}^{N}\left\lbrack {{4 \cdot \left( {x_{j} - x_{i}} \right) \cdot \left\lbrack {\left( x_{j} \right)^{3} - \left( x_{i} \right)^{3}} \right\rbrack} -} \right.}} \\\left. {{3\left\lbrack {\left( x_{j} \right)^{2} - \left( x_{i} \right)^{2}} \right\rbrack} \cdot \left\lbrack {\left( x_{j} \right)^{2} - \left( x_{i} \right)^{2}} \right\rbrack} \right\rbrack\end{matrix}}} & {{Equation}\mspace{14mu} 11}\end{matrix}$

The double sum identity above in Equation 4 is applied to Equation 11for the following results:

$\begin{matrix}{{intercept} = \frac{\begin{matrix}{{3 \cdot \left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left\lceil {\left( x_{i} \right)^{4} \cdot y_{i}} \right\rceil}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{3}} \right\rbrack \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\; \left( {x_{i} \cdot y_{i}} \right)} \right\rbrack}} \right\rbrack} +} \\\left\lbrack {\left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left\lceil {\left( x_{i} \right)^{4} \cdot y_{i}} \right\rceil}} \right\rbrack - {\left( {\sum\limits_{i = 1}^{N}\; x_{i}} \right)\left\lbrack {\sum\limits_{i = 1}^{N}\; \left\lceil {\left( x_{i} \right)^{3} \cdot y_{i}} \right\rceil} \right\rbrack}} \right\rbrack -} \right. \\{\left. {3 \cdot \left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left\lceil {\left( x_{i} \right)^{4} \cdot y_{i}} \right\rceil}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{2}} \right\rbrack \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\mspace{11mu} \left\lceil {\left( x_{i} \right)^{2} \cdot y_{i}} \right\rceil} \right\rbrack}} \right\rbrack} \right\rbrack -} \\\left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left\lceil {\left( x_{i} \right)^{4} \cdot y_{i}} \right\rceil}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{4}} \right\rbrack \cdot \left( {\sum\limits_{i = 1}^{N}\; y_{i}} \right)}} \right\rbrack\end{matrix}}{\begin{matrix}\left\lbrack {{4\left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left\lbrack {\left( x_{i} \right)^{3}x_{i}} \right\rbrack}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{3}} \right\rbrack \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)} \right\rbrack}} \right\rbrack} -} \right. \\\left. {3 \cdot \left\lbrack {\left\lbrack {N \cdot {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{4}}} \right\rbrack - {\left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{3}} \right\rbrack \left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{2}} \right\rbrack}} \right\rbrack} \right\rbrack\end{matrix}}} & {{Equation}\mspace{14mu} 12}\end{matrix}$

Which reduces to:

$\begin{matrix}{{intercept} = \frac{{\sum\limits_{i = 1}^{N}\; {y_{i} \cdot {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{4}}}} - {\sum\limits_{i = 1}^{N}\; {x_{i} \cdot {\sum\limits_{i = 1}^{N}\; \left\lbrack {\left( x_{i} \right)^{3} \cdot y_{i}} \right\rbrack}}} - {3 \cdot {\sum\limits_{i = 1}^{N}\; {\left( {x_{i} \cdot y_{i}} \right) \cdot {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{3}}}}} + {3 \cdot {\sum\limits_{i = 1}^{N}\; {\left\lbrack {\left( x_{i} \right)^{2} \cdot y_{i}} \right\rbrack \cdot {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{2}}}}}}{{3 \cdot \left\lbrack {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{2}} \right\rbrack^{2}} - {4 \cdot {\sum\limits_{i = 1}^{N}\; {x_{i} \cdot {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{3}}}}} + {N \cdot {\sum\limits_{i = 1}^{N}\; \left( x_{i} \right)^{4}}}}} & {{Equation}\mspace{14mu} 13}\end{matrix}$

FIG. 2 is a simple flow chart that illustrates calculating gyroscopeoffset in accordance with an embodiment. First, running sums oftemperature 106 and offset 102 are provided, via step 104. In anembodiment, the running sum of the slope is calculated via step 110. Inanother embodiment, the running sum of the intercept is calculated viastep 108. Step 108 may be optional. The gyroscope offset is calculatedutilizing the calculated slope and/or intercept, via step 112. Todescribe the calculation of the gyroscope offset in more detail refernow to the following description in conjunction with the accompanyingfigures.

FIG. 3 is a flow chart that illustrates the offset estimation process inaccordance with the present invention. First, a new temperature (X) andits associated offset are received, via step 302. Then, new running sumsof temperature and offset (S′) are calculated using the new temperature(X), stored offset (Y) and old running sums of temperature and offset(S), via step 304. Next, a count of new temperature values (N) isincremented, via step 305. Then, one or more slopes are calculated usingthe new running sums of temperature and offset (S′), via step 306.Thereafter, a new offset (Y′) is calculated and stored, via step 308. Inaddition to calculating one or more slopes, it is important in somecircumstances to also calculate one or more intercepts to provide a moreaccurate offset value estimation.

Implementation

With the calculations defined in FIG. 3, implementation details can nowbe carried out. FIG. 4A illustrates the variables to be utilized foroffset estimation for a three element gyroscope. For example, given athree element gyroscope offset and a temperature, the temperature wouldbe the x variable, and the gyroscope offset would be the y variable ineach of the three axes. FIG. 4A illustrates running sums to becalculated: for N 401 which is the number of data points, for a firstcolumn 402 which represents temperature, for a second column 404 whichrepresent the temperature and the gyroscope offset along a first axis(x); for a third column 406 which represent the temperature and thegyroscope offset along a second axis (y); and for a fourth column 408which represent the running sum for temperature and the gyroscope offsetalong a third axis (z). Therefore for each access, running sums arecalculated for a total of 17 variables. The equation for slope andintercept can be applied after N is 2 or ore.

It may be desired to limit the value of N for numerical stability. Oneembodiment would be to limit N to 3000, and after N reaches 3000, thenall the running sums and the counter N, are multiplied by 0.9. Scalingby 0.9 has an effect of weighting new data more and to prevent numericalstability issues that may arise if the running sums to continue to grow.Another method to limit the effect of numerical stability would be tomake sure the temperature has changed by a minimum amount since the lastdata storage. A change of 1 or 2 degrees Celsius should be sufficientbefore adding the data to the data set of running sums. Storing theprevious temperature would require 1 more persistent data storagevariable.

To use the results to perform temperature compensation, the temperatureis measured. Then the gyroscope would be corrected by subtracting outthe estimated offset, where slope and intercept is determined by themath with the running sums in it above.

Gyro_Corrected=Gyro_Measured−Slope*Temperature−Intercept

Extension to Piece-Wise Linear

The core algorithm can be extended for piecewise linear. For thisembodiment, an accelerometer is considered where a piecewise linear fitis done where the piecewise breakpoint is at 25 degrees C. FIG. 4B showsa plot of the data, and the resulting curve fit.

Just as above, for the gyroscope example embodiment, where 17 runningsums and 1 count of the number of terms for 3 axes were stored, asimilar method can also be used to reduce the number of terms to store.However, because 2 pieces are required for a linear fit the number ofterms would double to 34 terms. If the temperature is forced to move bya set amount such as at least 1 or 2 degrees C. then 35 persistentstorage terms would be needed for a 2 piecewise term and 3 axes. Whenstoring the data, for this embodiment, if the temperature was above 25C, then the data would be applied to one set of running sums and numberof data points. If the temperature was below 25 C, then the data wouldbe applied to the other set of running sums and number of data points.

Although the present invention has been described in accordance with theembodiments shown, one of ordinary skill in the art will readilyrecognize that there could be variations to the embodiments and thosevariations would be within the spirit and scope of the presentinvention. Accordingly, many modifications may be made by one ofordinary skill in the art without departing from the spirit and scope ofthe appended claims.

What is claimed is:
 1. A computer implemented method for estimating anoffset of at least one sensor comprises: calculating combinations ofrunning sums of temperature and an associated offset for computing oneor more slopes for the at least one sensor, wherein the one or moreslopes provides an indication of how an offset of the at least onesensor changes with temperature.
 2. The method of claim 1, wherein thecalculating includes computing one or more intercepts for the at leastone sensor, wherein the one or more intercepts provides an indication ofhow the offset of the at least one sensor changes with temperature. 3.The method of claim 1, wherein the calculating includes computing anaverage slope for a set of data from the at least one sensor weighted bya fourth order equation of the distance along a temperature axis for allcombination of pairs of points by using running sums of various powersof the data.
 4. The method of claim 2, wherein sensor data that arefurther apart in temperature are given more weight to improve accuracy.5. The method of claim 1, which includes providing a piecewise linearfit of the data to improve accuracy, wherein the piecewise breakpoint isat a predetermined temperature.
 6. A device comprising: a processor; atleast one sensor for providing data; and a memory coupled to theprocessor; wherein the memory receives the data from the at least onesensor; wherein the memory includes an algorithm for estimating theoffset of the sensor data; wherein the processor executes the algorithmto perform the following operations; calculating combinations of runningsums of temperature and an associated offset for computing one or moreslopes for the at least one sensor, wherein the one or more slopesprovides an indication of how an offset of the at least one sensorchanges with temperature.
 7. The device of claim 6, wherein thecalculating includes computing one or more intercepts for the at leastone sensor, wherein the one or more intercepts provides an indication ofhow the offset of the at least one sensor changes with temperature. 8.The device of claim 6, wherein the calculating includes computing anaverage slope for a set of data from the at least one sensor weighted bya fourth order equation of the distance along a temperature axis for allcombination of pairs of points by using running sums of various powersof the data.
 9. The device of claim 7, wherein sensor data that arefurther apart in temperature are given more weight to improve accuracy.10. The device of claim 6, which includes providing a piecewise linearfit of the data to improve accuracy, wherein the piecewise breakpoint isat a predetermined temperature.
 11. A computer program product includingprogram instructions for estimating an offset of at least one sensor,the program instructions being executed by a computer for performing thefollowing operations: calculating combinations of running sums oftemperature and an associated offset for computing one or more slopesfor the at least one sensor, wherein the one or more slopes provides anindication of how an offset of the at least one sensor changes withtemperature.
 12. The computer program product of claim 11, wherein thecalculating includes computing one or more intercepts for the at leastone sensor, wherein the one or more intercepts provides an indication ofhow the offset of the at least one sensor changes with temperature. 13.The computer program product of claim 11, wherein the calculatingincludes computing an average slope for a set of data from the at leastone sensor weighted by a fourth order equation of the distance along atemperature axis for all combination of pairs of points by using runningsums of various powers of the data.
 14. The computer program product ofclaim 12, wherein sensor data that are further apart in temperature aregiven more weight to improve accuracy.
 15. The computer program productof claim 11, which includes providing a piecewise linear fit of the datato improve accuracy, wherein the piecewise breakpoint is at apredetermined temperature.